      SUBROUTINE E01DAQ(N,NSETS,NUFCTR,UFCTR,LUFCTR,THETA,IT1,IT2,
     *                  LTHETA,SFRSS,ISF1,LSFRSS,SRSS,ISR1,LSRSS)
C     MARK 14 RELEASE. NAG COPYRIGHT 1989.
C     A DASL routine, unmodified except for name, and calls to
C     DASL routine VCONST replaced by functionally equivalent NAG.
C
C     **********************************************************
C
C     D A S L  -  DATA APPROXIMATION SUBROUTINE LIBRARY
C
C     SUBROUTINE INITR     INITIALIZE UPPER TRIANGULAR
C     ================     MATRIX, RIGHT HAND SIDES AND
C                          RESIDUAL SUMS OF SQUARES
C
C     CREATED 18 07 78.  UPDATED 21 04 82.  RELEASE 00/04
C
C     AUTHORS ... MAURICE G. COX AND PAULINE E. M. CURTIS.
C     NATIONAL PHYSICAL LABORATORY, TEDDINGTON,
C     MIDDLESEX TW11 OLW, ENGLAND.
C
C     (C)  CROWN COPYRIGHT 1978-1982
C
C     **********************************************************
C
C     INITR.  INITIALIZE TO ZERO AN UPPER TRIANGULAR MATRIX,
C     UFCTR, AND A SET OF RIGHT HAND SIDES, WITHIN THE
C     RECTANGULAR DATA STRUCTURE  THETA.  ALSO INITIALIZE
C     RESIDUAL SUMS OF SQUARES TO ZERO, BY SETTING SCALED
C     RESIDUAL SUMS OF SQUARES, SRSS, TO UNITY, AND SCALE
C     FACTORS, SFRSS, FOR RESIDUAL SUMS OF SQUARES, TO ZERO.
C
C     INPUT PARAMETERS
C        N        ORDER OF UPPER TRIANGULAR MATRIX  UFCTR
C        NSETS    NUMBER OF RIGHT HAND SIDES
C        NUFCTR   NUMBER OF ELEMENTS OF  UFCTR  TO BE
C                    INITIALIZED
C
C     OUTPUT (AND ASSOCIATED) PARAMETERS
C        UFCTR    UPPER TRIANGULAR MATRIX
C        LUFCTR   DIMENSION OF  UFCTR
C        THETA    RIGHT HAND SIDE VECTORS
C        IT1,
C        IT2      INDEX INCREMENTS OF  THETA
C        LTHETA   DIMENSION OF  THETA
C        SFRSS    SCALE FACTORS FOR RESIDUAL SUMS OF SQUARES
C        ISF1     INDEX INCREMENT OF  SFRSS
C        LSFRSS   DIMENSION OF  SFRSS
C        SRSS     SCALED RESIDUAL SUMS OF SQUARES
C        ISR1     INDEX INCREMENT OF  SRSS
C        LSRSS    DIMENSION OF  SRSS
C
C     ----------------------------------------------------------
C
C     .. Scalar Arguments ..
      INTEGER           ISF1, ISR1, IT1, IT2, LSFRSS, LSRSS, LTHETA,
     *                  LUFCTR, N, NSETS, NUFCTR
C     .. Array Arguments ..
      DOUBLE PRECISION  SFRSS(LSFRSS), SRSS(LSRSS), THETA(LTHETA),
     *                  UFCTR(LUFCTR)
C     .. Local Scalars ..
      DOUBLE PRECISION  ONE, ZERO
      INTEGER           ISET, ITREF
C     .. External Subroutines ..
      EXTERNAL          F06FBF
C     .. Data statements ..
C
      DATA              ZERO, ONE/0.0D+0, 1.0D+0/
C     .. Executable Statements ..
C
C     INITIALIZE UPPER TRIANGULAR FACTOR
C
C      CALL VCONST ( ZERO, NUFCTR, UFCTR, 1, LUFCTR )
C      Replace call to DASL VCONST above by call to Nag F06FBF.
      CALL F06FBF(NUFCTR,ZERO,UFCTR,1)
      IF (NSETS.LE.0) GO TO 40
C
C     INITIALIZE RIGHT HAND SIDE VECTORS
C
      ITREF = 1 - IT2
      DO 20 ISET = 1, NSETS
         ITREF = ITREF + IT2
C         CALL VCONST ( ZERO, N, THETA(ITREF),
C        *                 IT1, LTHETA - ITREF + 1 )
         CALL F06FBF(N,ZERO,THETA(ITREF),IT1)
   20 CONTINUE
C
C     INITIALIZE RESIDUAL SUMS OF SQUARES
C
C      CALL VCONST ( ZERO, NSETS, SFRSS, ISF1, LSFRSS )
      CALL F06FBF(NSETS,ZERO,SFRSS,ISF1)
C      CALL VCONST ( ONE, NSETS, SRSS, ISR1, LSRSS )
      CALL F06FBF(NSETS,ONE,SRSS,ISR1)
   40 CONTINUE
      RETURN
C
C     END E01DAQ
C
      END
